import { getCommonProblemById } from "../../../api/index";
import { tntInstId, scene } from "../../../setting";
const parse = require("../../../node_modules/mini-html-parser2");

Page({
  data: {
    tntInstId,
    scene,
    title: '',
    nodes: []
  },
  toOnline() {

  },
  getData(id) {
    getCommonProblemById(id).then(res => {
      if (res.content) {
        parse(res.content, (err, nodes) => {
          if (!err) {
            this.setData({
              title: res.article_title,
              nodes: nodes
            })
          }
        })
      }
    })
  },
  onLoad(options) {
    this.getData(options.id);
  },
});
